//
//  RDHomeTodayCollectionViewCell.m
//  ReverseDiabetes
//
//  Created by 王佩璇 on 2024/8/25.
//

#import "RDHomeTodayCollectionViewCell.h"
#import "RDBloodSugarTag.h"
@interface RDHomeTodayCollectionViewCell ()
@property (weak, nonatomic) IBOutlet UILabel *bloodSugarValueLab;
@property (weak, nonatomic) IBOutlet UILabel *bloodSugarTagLab;

@end
@implementation RDHomeTodayCollectionViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setModel:(RDBloodSugar *)model{
    _model = model;
    
    self.bloodSugarValueLab.text = model.blood_sugar_value;
    
    RDBloodSugarTag *bloodSugarTag = [RDBloodSugarTool getTagById:model.blood_sugar_tag];
    self.bloodSugarTagLab.text = bloodSugarTag.tag_name;
    
    switch ([RDBloodSugarTool getStateByBloodSugar:model]) {
        case 0:
            self.backgroundColor = [UIColor greenColor];
            break;
        case 1:
            self.backgroundColor = [UIColor orangeColor];
            break;
        case 2:
            self.backgroundColor = [UIColor redColor];
            break;
        default:
            self.backgroundColor = [UIColor whiteColor];
            break;
    }
    
}

@end
